$OpenBSD: patch-src_CMakeLists_txt,v 1.4 2017/04/15 20:49:09 sthen Exp $
--- src/CMakeLists.txt.orig	Mon Feb 20 22:06:57 2017
+++ src/CMakeLists.txt	Fri Apr 14 14:34:19 2017
@@ -95,6 +95,8 @@ endif (HAVE_GETADDRINFO_A)
 if (UNIX)
 	if (APPLE)
 		set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
+	elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
+		set (MOSQ_LIBS ${MOSQ_LIBS} m)
 	else (APPLE)
 		set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
 		find_library(LIBRT rt)
@@ -112,14 +114,22 @@ if (${WITH_WEBSOCKETS} STREQUAL ON)
 	set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
 endif (${WITH_WEBSOCKETS} STREQUAL ON)
 
+# DCE 1.1 RPC uuid functions
+include(CheckSymbolExists)
+CHECK_SYMBOL_EXISTS(uuid_create uuid.h UUID_CREATE)
+if (UUID_CREATE)
+	add_definitions(-DWITH_UUID_CREATE)
+endif (UUID_CREATE)
+
 # Simple detect libuuid
-if(NOT APPLE)
+if(NOT UUID_CREATE)
 	FIND_PATH(UUID_HEADER uuid/uuid.h)
-	if (UUID_HEADER)
+	FIND_LIBRARY(UUID_LIBRARY NAMES uuid)
+	if (UUID_HEADER AND UUID_LIBRARY)
 		add_definitions(-DWITH_UUID)
-		set (MOSQ_LIBS ${MOSQ_LIBS} uuid)
-	endif (UUID_HEADER)
-endif(NOT APPLE)
+		set (MOSQ_LIBS ${MOSQ_LIBS} ${UUID_LIBRARY})
+	endif()
+endif(NOT WITH_UUID_CREATE)
 
 target_link_libraries(mosquitto ${MOSQ_LIBS})
 
@@ -139,8 +149,4 @@ if (${WITH_TLS} STREQUAL ON)
 	target_link_libraries(mosquitto_passwd "${OPENSSL_LIBRARIES}")
 	install(TARGETS mosquitto_passwd RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}")
 endif (${WITH_TLS} STREQUAL ON)
-
-if (UNIX)
-	install(CODE "EXEC_PROGRAM(/sbin/ldconfig)")
-endif (UNIX)
 
